<template>
  <el-container>
    <el-header height="200px" style="box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04)">
      <el-row>
        <el-col :span="1.5">
          <i class="el-icon-user-solid"></i> &nbsp;&nbsp;&nbsp;
          <span style="line-height: 60px"><b>司机个人信息</b></span>
        </el-col>
      </el-row>
      <el-form :model="queryParams" ref="form" label-width="80px">
        <el-col :span="6">
          <el-form-item label="电话" label-width="100px" prop="telephone">
            <el-input
              v-model="queryParams.telephone"
              placeholder="请输入电话"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="姓名" label-width="100px" prop="name">
            <el-input
              v-model="queryParams.name"
              placeholder="请输入姓名"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="性别" label-width="100px">
            <el-radio-group v-model="queryParams.sex" size="mini">
              <el-radio
                v-for="dict in dict.type.sys_user_sex"
                :key="dict.value"
                :label="dict.value"
              >{{dict.label}}</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="年龄" label-width="100px" prop="sex">
            <el-input
              v-model="queryParams.sex"
              placeholder="请输入年龄"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="开户银行" label-width="100px" prop="openingBank">
            <el-input
              v-model="queryParams.openingBank"
              placeholder="请输入开户银行"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="银行卡号" label-width="100px" prop="bankCardNumber">
            <el-input
              v-model="queryParams.bankCardNumber"
              placeholder="请输入银行卡号"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="银行卡开户地" label-width="100px" prop="bankOfDeposit">
            <el-input
              v-model="queryParams.bankOfDeposit"
              placeholder="请输入银行卡开户地"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="电子邮箱" label-width="100px" prop="email">
            <el-input
              v-model="queryParams.email"
              placeholder="请输入电子邮箱"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="微信号" label-width="100px" prop="wechatNumber">
            <el-input
              v-model="queryParams.wechatNumber"
              placeholder="请输入微信号"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="被评价次数" label-width="100px" prop="beEvaluated">
            <el-input
              v-model="queryParams.beEvaluated"
              placeholder="请输入被评价次数"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="评价总分" label-width="100px" prop="totalEvaluate">
            <el-input
              v-model="queryParams.totalEvaluate"
              placeholder="请输入评价总分"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="司机运输次数" label-width="100px" prop="transportNumber">
            <el-input
              v-model="queryParams.transportNumber"
              placeholder="请输入司机运输次数"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="司机家庭住址" label-width="100px" prop="homeAdd">
            <el-input
              v-model="queryParams.homeAdd"
              placeholder="请输入司机家庭住址"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
      </el-form>
    </el-header>
    <br>
    <el-header v-show="exists" height="200px" style="box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04)">
      <el-row>
        <el-col :span="1.5">
          <i class="el-icon-user-solid"></i> &nbsp;&nbsp;&nbsp;
          <span style="line-height: 60px"><b>司机所属车源信息</b></span>
        </el-col>
      </el-row>
      <el-form :model="carInfo" ref="form" label-width="80px">
        <el-col :span="6">
          <el-form-item label="出发地点" label-width="100px" prop="startAddress">
            <el-input
              v-model="carInfo.startAddress"
              placeholder="请输入出发地点"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="到达地点" label-width="100px" prop="endAddress">
            <el-input
              v-model="carInfo.endAddress"
              placeholder="请输入到达地点"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="车牌" label-width="100px" prop="plateNo">
            <el-input
              v-model="carInfo.plateNo"
              placeholder="请输入到达车牌"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="车型" label-width="100px" prop="carStyle">
            <el-input
              v-model="carInfo.carStyle"
              placeholder="请输入车型"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="车长" label-width="100px" prop="carLength">
            <el-input
              v-model="carInfo.carLength"
              placeholder="请输入车长"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="载重" label-width="100px" prop="loadWeight">
            <el-input
              v-model="carInfo.loadWeight"
              placeholder="请输入载重"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="车辆所属" label-width="100px" prop="type">
            <el-radio-group v-model="carInfo.type">
              <el-radio
                v-for="dict in dict.type.supply_of_cars_info_type"
                :key="dict.value"
                :label="dict.value"
              >{{dict.label}}</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="状态" label-width="100px" prop="status">
            <el-radio-group v-model="carInfo.status">
              <el-radio
                v-for="dict in dict.type.auth_status"
                :key="dict.value"
                :label="dict.value"
              >{{dict.label}}</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>

      </el-form>
    </el-header>
  </el-container>
</template>

<script>
import { listInfo, getInfo, delInfo, addInfo, updateInfo, getCarInfo} from "@/api/person/driver";
import {carGetInfo} from "@/api/business/miniCar";

export default {
  name: 'CongisnorDetail',
  dicts: ['sys_user_sex', 'supply_of_cars_info_type', 'auth_status'],
  data() {
    return {
      queryParams: {},
      // 根据该车源框是否展示
      exists: false,
      // 车源信息
      carInfo: {
        pageNum: 1,
        pageSize: 10,
        startAddress: null,
        endAddress: null,
        plateNo: null,
        carStyle: null,
        carLength: null,
        loadWeight: null,
        type: null,
        status: null
      },
    }
  },
  created() {
    this.getDriverListById(this.$route.query.id);
  },
  methods: {
    /** 查询车主个人信息列表 */
    getDriverListById(id) {
      getInfo(id).then(response => {
        this.queryParams = response.data
        if (this.queryParams.supplyOfCarsId !== null) {
          this.exists = true
          carGetInfo(this.queryParams.supplyOfCarsId).then(response => {
            this.carInfo = response.data
          })
        }
      });
    },
  }
}
</script>

<style scoped>
.el-header, .el-footer {
  background-color: #f7fbff;
  color: #333;
  text-align: center;
}


.el-main {
  background-color: #B3C0D1;
  color: #333;
  text-align: center;
  height: 600px;
}

#container {
  width: 100%;
  height: 100%;
}

.el-row {
  margin-bottom: 20px;
}

.el-col {
  height: 35px;
}

.bg-purple-dark {
  background: #99a9bf;
}

.bg-purple {
  background: #d3dce6;
}

.bg-purple-light {
  background: #e5e9f2;
}

.grid-content {
  border-radius: 4px;
  min-height: 36px;
}

.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}
</style>
